package cn.uc.ucgc.community.upgrade;

import java.io.File;
import java.io.FileNotFoundException;
import java.net.URISyntaxException;
import java.net.URL;

import org.apache.log4j.PropertyConfigurator;

public class GloableTestSetup {
    /**
     * 初始化log4j
     */
    public static void setUp() {
        URL log4jCfg = GloableTestSetup.class.getClassLoader().getResource("log4j.properties");
        PropertyConfigurator.configure(log4jCfg);
    }
    
    public static File getFile(String resName) throws URISyntaxException, FileNotFoundException {
        URL upgradeHomeUrl = GloableTestSetup.class.getClassLoader().getResource(resName);
        File home = new File(upgradeHomeUrl.toURI());
        if (!home.exists()) {
            throw new FileNotFoundException("can not find");
        }
        return home;
    }
}
